package com.goldgov.code.template.point.impl;

import com.goldgov.code.template.point.CodePoint;
import com.goldgov.code.utils.CodeUtils;

public class MethodAnnotationCodePoint extends CodePoint{
	
	private final String[] annotation;

	public MethodAnnotationCodePoint(String method,String... annotation) {
		super("JAVA:METHOD_ANNOTATION:"+method.toUpperCase());
		this.annotation = annotation;
	}
	
	public MethodAnnotationCodePoint(String method,Class<?>... annoClass) {
		super("JAVA:METHOD_ANNOTATION:"+method.toUpperCase());
		this.annotation = new String[annoClass.length];
		for (int i = 0; i < annoClass.length; i++) {
			this.annotation[i] = "@" + annoClass[i].getSimpleName();
		}
	}
	
	@Override
	public String getCodes() {
		StringBuilder strBuilder = new StringBuilder();
		if(annotation != null) {
			for (String anno : annotation) {
				strBuilder.append(CodeUtils.code(1,anno));
			}
		}
		return strBuilder.toString();
	}

}